$(function(){
    //最新
    $.ajax({
        url: "http://127.0.0.1:3000/report/new",
        type: 'get',
        success: function (res) {
            console.log(res);
            for (var i = 0; i < 8; i++) {


                $('.baog_xl ul').append(
                    `<li>
                    <div class="baogao">
                        <img class="bj" src="${res[i].img}" alt="">
                        <div class="baog_zi">
                            <span>${res[i].text}</span><br>
                            <span><img src="./img/tx.jpg" alt="">${res[i].uName}<span>${res[i].endTime}</span></span>
                            <span><img src="./img/zan.png" alt="">&nbsp;3&nbsp;<img src="./img/reply.png" alt="">&nbsp;3&nbsp;</span>
                        </div>
                    </div>
                    <a href="#">关于${res[i].text}还有4篇报告，点击查看</a>
                </li>`
                )

            }
        }
    })

    $.ajax({
        url: "http://127.0.0.1:3000/report/hot",
        type: 'get',
        success: function (res) {
            console.log(res);
            for (var i = 0; i < 8; i++) {


                $('.baog_rl ul').append(
                    `<li>
                    <div class="baogao">
                        <img class="bj" src="${res[i].img}" alt="">
                        <div class="baog_zi">
                            <span>${res[i].text}</span><br>
                            <span><img src="./img/tx.jpg" alt="">${res[i].uName}<span>${res[i].endTime}</span></span>
                            <span><img src="./img/zan.png" alt="">&nbsp;3&nbsp;<img src="./img/reply.png" alt="">&nbsp;3&nbsp;</span>
                        </div>
                    </div>
                    <a href="#">关于${res[i].text}还有4篇报告，点击查看</a>
                </li>`
                )

            }
        }
    })


    //点击
    $('.kuw_t span').click(function () {
        var index = $(this).index()
        console.log(index);
        $('.bg>.baogao').eq(index-1).show().siblings().hide()
        $(this).addClass('kuw_t_zi').siblings().removeClass()
    })
})